.contextMenu {
  position: fixed;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--border-radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  min-width: 140px;
  padding: 4px 0;
  user-select: none;
  animation: menuSlideIn 0.15s ease-out;
}

@keyframes menuSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-5px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.menuItem {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  font-size: 13px;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  outline: none;
}

.menuItem:hover {
  background: var(--color-bg-hover);
}

.menuItem:focus {
  background: var(--color-bg-hover);
  box-shadow: inset 2px 0 0 var(--color-primary);
}

.menuItem.danger {
  color: var(--color-error);
}

.menuItem.danger:hover {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}

.menuItem.danger:focus {
  background: var(--color-error-bg);
  box-shadow: inset 2px 0 0 var(--color-error);
  color: var(--color-error-text);
}

.icon {
  margin-right: 8px;
  font-size: 14px;
  min-width: 14px;
  text-align: center;
}

.text {
  flex: 1;
  text-align: left;
  white-space: nowrap;
}

.separator {
  height: 1px;
  background: var(--color-border-secondary);
  margin: 4px 8px;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .contextMenu {
    min-width: 120px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  }
  
  .menuItem {
    padding: 12px 14px;
    font-size: 14px;
  }
  
  .icon {
    font-size: 15px;
    margin-right: 10px;
  }
}

@media (max-width: 480px) {
  .contextMenu {
    min-width: 110px;
  }
  
  .menuItem {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .icon {
    font-size: 14px;
    margin-right: 8px;
  }
}

/* 暗色主题适配 */
@media (prefers-color-scheme: dark) {
  .contextMenu {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .contextMenu {
    border: 2px solid var(--color-border-primary);
  }
  
  .menuItem:focus {
    box-shadow: inset 3px 0 0 var(--color-primary);
  }
  
  .menuItem.danger:focus {
    box-shadow: inset 3px 0 0 var(--color-error);
  }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  .contextMenu {
    animation: none;
  }
  
  .menuItem {
    transition: none;
  }
}
